- valid_until_msg = t('error_messages.listings.valid_until')

= js_t ["listings.form.images.processing", "listings.form.images.this_may_take_a_while", "listings.form.images.percentage_loaded", "listings.form.images.uploading_failed", "listings.form.images.file_too_large", "listings.form.images.image_processing_failed", "listings.form.images.accepted_formats", "listings.form.images.loading_image", "listings.form.images.select_file", "listings.form.images.removing", "listings.form.images.add_more"], run_js_immediately

- content_for :listing_js do
  :javascript
    $(document).ready(function() {
      var listingImageOpts = #{raw ListingImageS3OptionsJsAdapter.new(@listing).to_json}
      var listingImages = #{raw @listing.listing_images.map { |image| ListingImageJsAdapter.new(image) }.to_json }

      window.ST.initialize_new_listing_form("#{t('listings.form.images.no_file_selected')}", "#{t('listings.form.images.select_file')}", "#{I18n.locale}", "#{t('error_messages.listings.share_type')}", "#{valid_until_msg}", "#{listing_id}", "#{shape[:price_enabled]}","#{t('error_messages.listings.price')}","#{minimum_price_cents}","#{Money::Currency.new(@current_community.currency).subunit_to_unit}","#{t('error_messages.listings.minimum_price', :minimum_price => Money.new(minimum_price_cents, @current_community.currency), :currency => @current_community.currency)}", #{raw @numeric_field_ids.collect { |numeric_field_id| "custom_fields[#{numeric_field_id}]" }.to_json }, listingImages, listingImageOpts, "#{t('listings.form.images.images_not_uploaded_confirm')}" );
    });

- if run_js_immediately
  = yield :listing_js
- else
  - content_for :extra_javascript do
    = yield :listing_js
